#include "llt_printer.hh"

using namespace userFunction;

void
printer::processData(lee::PktData * const pkt, uint32_t pktSize)
{
  assert(pkt != NULL);

  lee::IP_Packet ipPkt((lee::payload_t)pkt, pktSize);
  lee::TCP_Packet tcpPkt(ipPkt);
  //tt::IPAddress srcAddr(ipPkt.getSrcAddr());
  //std::cout << "SRC: " << srcAddr << std::endl;
  //uint32_t temp = ipPkt.getSrcAddr();
  ipPkt.setSrcAddr(ipPkt.getDstAddr());
  uint32_t newaddr = 0x0;
  newaddr = newaddr | (128 << 24);
  newaddr = newaddr | (83 << 16);
  newaddr = newaddr | (140 << 8);
  newaddr = newaddr | 10;
  ipPkt.setDstAddr(newaddr);
  ipPkt.chksum();
  tcpPkt.chksum();
  
//   uint32_t temp = packet.ipHdr->saddr;
//   packet.ipHdr->saddr = packet.ipHdr->daddr;
//   packet.ipHdr->daddr = temp;
  //tt::IPAddress srcNewAddr(ipPkt.getSrcAddr());
  //std::cout << "NEW SRC: " << srcNewAddr << std::endl;
  assert(pkt != NULL);
  normal(pkt,pktSize);
  return;
}
